﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using BMC.ARSystem;

namespace Wicresoft.UnifyShow.Business
{
    public class ARHelper
    {
        public static void SyncAddListBusinessSystemToAR(IList<Dictionary<uint, string>> values)
        {
            Server s = new Server();
            s.Login(ConfigurationManager.AppSettings["ARServer"],
                ConfigurationManager.AppSettings["ARUid"], ConfigurationManager.AppSettings["ARPwd"]);
            List<FieldValueList> fvls = new List<FieldValueList>();
            FieldValueList fvl;
            foreach (var item in values)
            {
                var keys = item.Keys;
                fvl = new FieldValueList();
                foreach (var item1 in keys)
                {
                    fvl.Add(item1, item[item1]);
                }
                fvl.Add(536870919, 0);
                fvls.Add(fvl);
            }
            foreach (var item in fvls)
            {
                s.CreateEntry("FJ_HPD:Help Desk_BusinessSystemInterface", item);
            }
            s.Logout();
        }
        public static void SyncDeleteBusinessSystemToAR(Dictionary<uint, string> values)
        {
            Server s = new Server();
            s.Login(ConfigurationManager.AppSettings["ARServer"],
                ConfigurationManager.AppSettings["ARUid"], ConfigurationManager.AppSettings["ARPwd"]);
            FieldValueList fvl=new FieldValueList();
            var keys = values.Keys;
            foreach (var item1 in keys)
            {
                fvl.Add(item1, values[item1]);
            }
            fvl.Add(536870919, 1);
            s.CreateEntry("FJ_HPD:Help Desk_BusinessSystemInterface", fvl);
            s.Logout();
        }

        public static void SyncAddListEventTypeToAR(IList<Dictionary<uint, string>> values)
        {
            Server s = new Server();
            s.Login(ConfigurationManager.AppSettings["ARServer"],
                ConfigurationManager.AppSettings["ARUid"], ConfigurationManager.AppSettings["ARPwd"]);
            List<FieldValueList> fvls = new List<FieldValueList>();
            FieldValueList fvl;
            foreach (var item in values)
            {
                var keys = item.Keys;
                fvl = new FieldValueList();
                foreach (var item1 in keys)
                {
                    fvl.Add(item1, item[item1]);
                }
                fvl.Add(536870919, 0);
                fvls.Add(fvl);
            }
            foreach (var item in fvls)
            {
                s.CreateEntry("FJ_HPD:Help Desk EventType", item);
            }
            s.Logout();
        }
        public static void SyncDeleteEventTypeToAR(Dictionary<uint, string> values)
        {
            Server s = new Server();
            s.Login(ConfigurationManager.AppSettings["ARServer"],
                ConfigurationManager.AppSettings["ARUid"], ConfigurationManager.AppSettings["ARPwd"]);
            FieldValueList fvl = new FieldValueList();
            var keys = values.Keys;
            foreach (var item1 in keys)
            {
                fvl.Add(item1, values[item1]);
            }
            fvl.Add(536870919, 1);
            s.CreateEntry("FJ_HPD:Help Desk EventType", fvl);
            s.Logout();
        }
    }
}
